import React, { Component } from 'react'

 class App extends Component {
  render() {
    return (
      <div>
        <button onClick={this.props.sub}>-</button>
        {this.props.num}
        <button onClick={this.props.add}>+</button>
      </div>
    )
  }
}
function connect(Com){
  return class extends Component{
    state={
      num:555
    }
    sub=()=>{
      this.setState({
        num:this.state.num-1
      })
    }
    add=()=>{
      this.setState({
        num:this.state.num+1
      })
    }
    render(){
      return (
        <Com sub={this.sub} add={this.add} num={this.state.num}></Com>
      )
    }
  }
}
export default connect(App)